
#include <BClock>
#include <BShape>

#include "ICollide.h"
#include <BDriver>

using namespace BWE;

class driver_member
{
public:
	driver_member()
	{
		frequency = 60;
		gravity.set(0, 0, -9.8);
	}
	~driver_member()
	{

	}
	int				frequency;
	BVector			gravity;
	BClock			timer;
};
BList<BDriver*>& getDrivers()
{
	static BList<BDriver*> drivers;
	return drivers;
}

#define member					(*(driver_member*)_ptr)
#define member_allocate()		_ptr = new driver_member
#define member_release()		delete (driver_member*)_ptr

BDriver::BDriver()
{
	member_allocate();
	getDrivers().append(this);
}
BDriver::~BDriver()
{
	getDrivers().remove(this);
	member_release();
}

void BDriver::setGravity(const BVector& gravity)
{
	member.gravity = gravity;
}
const BVector& BDriver::gravity() const
{
	return member.gravity;
}

void BDriver::setFrequency(int frequency)
{
	member.frequency = frequency;
}
int BDriver::frequency()
{
	return member.frequency;
}


